package main

import (
	"fmt"
	"math/big"
)

// big.Int 的使用
func main() {
	// 创建big.Int 变量
	lightSpeed := big.NewInt(299792)
	secondsPerDay := big.NewInt(86400)

	// 把 24 x 10的18次方 转化为 big.Int 类型
	distance := new(big.Int)
	distance.SetString("24000000000000000000", 10) // 10代表十进制
	fmt.Println("Andromeda Galaxy is", distance, "km away.")

	seconds := new(big.Int)
	seconds.Div(distance, lightSpeed) // 除法计算得到seconds的值
	fmt.Println("That is", seconds, "seconds of travel at light speed.")

	days := new(big.Int)
	days.Div(seconds, secondsPerDay)

	fmt.Println("That is", days, "days of travel at light speed.")
}
